package main

import "fmt"

type Animaler interface {
	setName(string)
	getName() string
}

type Cat struct {
	Name string
}

func (c *Cat) setName(name string) {
	c.Name = name
}

func (c Cat) getName() string {
	return c.Name
}

type Dog struct {
	Name string
}

func (d *Dog) setName(name string) {
	d.Name = name
}

func (d Dog) getName() string {
	return d.Name
}

func main() {

	dog := Dog{
		Name: "小黑",
	}

	var animal Animaler = &dog

	fmt.Println(animal.getName())

	animal.setName("小白")

	fmt.Println(animal.getName())

}
